﻿using System;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;

namespace JuCheap.Core.Data.Migrations
{
    public partial class worker_check_attend : Migration
    {
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.AddColumn<int>(
                name: "Status",
                table: "Workers",
                nullable: false,
                defaultValue: 0);

            migrationBuilder.AddColumn<string>(
                name: "DeviceSn",
                table: "HardWareDevices",
                nullable: true);

            migrationBuilder.AddColumn<int>(
                name: "Status",
                table: "Companies",
                nullable: false,
                defaultValue: 0);

            migrationBuilder.CreateTable(
                name: "CheckWorkAttendances",
                columns: table => new
                {
                    Id = table.Column<int>(nullable: false)
                        .Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
                    CreateDateTime = table.Column<DateTime>(nullable: false),
                    IsDeleted = table.Column<bool>(nullable: false),
                    WorkerId = table.Column<int>(nullable: false),
                    Date = table.Column<DateTime>(nullable: false),
                    FirstTime = table.Column<DateTime>(nullable: true),
                    LastTime = table.Column<DateTime>(nullable: true),
                    TotalHour = table.Column<float>(nullable: false),
                    AddedHour = table.Column<float>(nullable: false)
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_CheckWorkAttendances", x => x.Id);
                });
        }

        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropTable(
                name: "CheckWorkAttendances");

            migrationBuilder.DropColumn(
                name: "Status",
                table: "Workers");

            migrationBuilder.DropColumn(
                name: "DeviceSn",
                table: "HardWareDevices");

            migrationBuilder.DropColumn(
                name: "Status",
                table: "Companies");
        }
    }
}
